@use 'sass:map';

@keyframes map-marker-cluster-ripple {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@include b(map) {
  position: relative;
  width: 100%;

  @include e(container) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
  }

  @include e(marker) {
    position: relative;
    display: inline-flex;
    align-items: center;
  }

  @include e(marker-label) {
    position: absolute;
    right: 0;
    padding: 3px 4px;
    /* stylelint-disable-next-line declaration-property-value-allowed-list */
    font-size: 12px;
    /* stylelint-disable-next-line declaration-property-value-allowed-list */
    color: #eef0f3;
    white-space: nowrap;
    pointer-events: none;
    background-color: var(--#{$rd-prefix}tooltip-background-color);
    border-radius: var(--#{$rd-prefix}border-radius);
    transform: translateX(100%);
  }

  @include e(marker-cluster) {
    position: relative;
    background-color: currentcolor;
    border-radius: 50%;
  }

  @include e(marker-cluster-text) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    /* stylelint-disable-next-line declaration-property-value-allowed-list */
    font-size: 14px;
    line-height: 1;
    color: map.get($rd-colors, 'white');
  }

  @include e(marker-cluster-ripple) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    div {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      border: 1px solid currentcolor;
      border-radius: 50%;
      animation: map-marker-cluster-ripple 3s infinite linear;
      animation-fill-mode: both;

      &:nth-child(1) {
        animation-delay: 0s;
      }

      &:nth-child(2) {
        animation-delay: 1s;
      }

      &:nth-child(3) {
        animation-delay: 2s;
      }
    }
  }

  @include e(info-window) {
    /* stylelint-disable-next-line declaration-property-value-allowed-list */
    font-size: 14px;
    background-color: var(--#{$rd-prefix}background-color);
    border-radius: var(--#{$rd-prefix}border-radius);
    box-shadow: var(--#{$rd-prefix}shadow-popup);
  }

  @include e(info-window-header) {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--#{$rd-prefix}color-divider);
  }

  @include e(info-window-title) {
    @include utils-ellipsis;

    flex: 1 0 0;
    font-size: 1.05em;
    font-weight: $rd-font-weight-bold;
  }

  @include e(info-window-close) {
    --#{$rd-prefix}size: calc(1.05em * 1.2) !important;

    .#{$rd-prefix}button__icon {
      font-size: 1.05em !important;
    }
  }

  @include e(info-window-body) {
    padding: 12px;
  }
}
